package cn.bonoon.kernel.bytecode;

import javax.persistence.EntityManager;

import cn.bonoon.kernel.events.ReadEvent;
/**
 * 从数据库把值读出来
 * @author jackson
 *
 */
public class EntityReader {
	/**
	 * 是否使用优化的读取模式
	 */
	protected boolean optimize = false;
	
	/**
	 * 
	 * @param ope
	 * @param manager
	 * @param id
	 * @return
	 */
	public Object read(ReadEvent ope, EntityManager manager, Long id)throws Exception{
		throw new RuntimeException("不支持对数据库实体的读取操作！");
	}
	
	public Object read(ReadEvent ope, Object entity)throws Exception{
		throw new RuntimeException("不支持对数据库实体的读取操作！");
	}
	
	public Object read(ReadEvent ope, Object entity, Object object)throws Exception{
		throw new RuntimeException("不支持对数据库实体的读取操作！");
	}
	
	public String properties(){
		optimize = false;
		return " x ";
	}
	
	public boolean isOptimize() {
		return optimize;
	}
}
